package com.lee.mao.bean;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Unique;

@Entity
public class MoneyTable implements Parcelable {

    @Unique
    @Id(autoincrement = true)
    private Long id;//id自增长

    private String name;//收入说明

    private long chargeTime;//收入日期

    private String money;//金额

    private int type;//类型。 0支出，1收入

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public MoneyTable(String name, long chargeTime, String money) {
        this.name = name;
        this.chargeTime = chargeTime;
        this.money = money;
    }

    public MoneyTable() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getChargeTime() {
        return chargeTime;
    }

    public void setChargeTime(long chargeTime) {
        this.chargeTime = chargeTime;
    }

    public String getMoney() {
        return money;
    }

    public void setMoney(String money) {
        this.money = money;
    }

    @Override
    public String toString() {
        return "MoneyTable{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", chargeTime=" + chargeTime +
                ", money='" + money + '\'' +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.id);
        dest.writeString(this.name);
        dest.writeLong(this.chargeTime);
        dest.writeString(this.money);
        dest.writeInt(this.type);
    }

    public void readFromParcel(Parcel source) {
        this.id = (Long) source.readValue(Long.class.getClassLoader());
        this.name = source.readString();
        this.chargeTime = source.readLong();
        this.money = source.readString();
        this.type = source.readInt();
    }

    protected MoneyTable(Parcel in) {
        this.id = (Long) in.readValue(Long.class.getClassLoader());
        this.name = in.readString();
        this.chargeTime = in.readLong();
        this.money = in.readString();
        this.type = in.readInt();
    }

    @Generated(hash = 2141279447)
    public MoneyTable(Long id, String name, long chargeTime, String money,
            int type) {
        this.id = id;
        this.name = name;
        this.chargeTime = chargeTime;
        this.money = money;
        this.type = type;
    }

    public static final Creator<MoneyTable> CREATOR = new Creator<MoneyTable>() {
        @Override
        public MoneyTable createFromParcel(Parcel source) {
            return new MoneyTable(source);
        }

        @Override
        public MoneyTable[] newArray(int size) {
            return new MoneyTable[size];
        }
    };
}